Skip to content

Disable AMP by default on CPU #9218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Disable AMP by default on CPU #9218

wants to merge 2 commits into from

Conversation

haifeng-jin
Copy link
Collaborator

@haifeng-jin haifeng-jin commented May 20, 2025

Resolves #9119.

The benchmarks in pytorch/xla does not work on CPU because of it is set to use AMP by default, which supports cuda and tpu only, but not cpus.

This PR fixes this issue by disable AMP by default when the accelerator is set to cpu.

@haifeng-jin
Copy link
Collaborator Author

Merging the PR. The failed tests is irrelevant to the change in this PR.
The tests failure is being investigated and appeared on other PRs as well.
So, merging.

@haifeng-jin haifeng-jin requested a review from ysiraichi May 21, 2025 17:38
@haifeng-jin
Copy link
Collaborator Author

Maybe wait for @ysiraichi 's comment before merging. : )

Copy link
Collaborator

@ysiraichi ysiraichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix. I think it would be nice to also have:

  1. A warning, so that the user knows AMP is not being used
  2. A test, checking that we don't error and AMP is not being used

@haifeng-jin
Copy link
Collaborator Author

Thank you for the fix. I think it would be nice to also have:

  1. A warning, so that the user knows AMP is not being used
  2. A test, checking that we don't error and AMP is not being used

I added the warning.
However, for the test, I do not see any existing tests for the benchmarks.
Is there any such test? If not, I suggest we open a separate issue and implement some of these basic tests in another PR.
WDYT? @ysiraichi

@haifeng-jin haifeng-jin requested a review from ysiraichi May 22, 2025 17:41
@ysiraichi
Copy link
Collaborator

There are already some benchmark tests here: https://github.com/pytorch/xla/tree/master/test/benchmarks

@haifeng-jin
Copy link
Collaborator Author

Great! working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The benchmarks does not work on CPU because of AMP
3 participants